<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/**
 * Description of genReporte
 *
 * @author mini
 */
class Reportes extends CI_Controller {

    public function __construct() {
        parent::__construct();
        global $admin, $data;
        #Cargamos datos del administrador
        $admin = $this->session->userdata('admin');
        $this->verificacion_acceso($admin);
        $admin['place'] = 'reportes';
        $this->output->enable_profiler(FALSE);
    }

    public function index() {
        global $admin, $data;


        $this->load->view('template/header', $admin);
        $this->load->view('template/open_content_container');
        $this->load->view('menu/menu_admin', $data);
        $this->load->view('genReporte/reportes/content');
        $this->load->view('template/close_content_container');
        $this->load->view('template/footer');
    }

    /**
     * Funcion que se encarga de verificar que 
     * se logueara antes
     */
    public function verificacion_acceso($admin) {
        if ($admin['ta_tipo_administrador_id'] != 1) {
            redirect('home');
        }
    }

    public function reporteabc() {
        global $admin, $data;
        $data['empresa'] = $this->cc_model_a->lista_empresas();
        $this->load->view('template/header', $admin);
        $this->load->view('template/open_content_container');
        $this->load->view('menu/menu_admin', $data);
        $this->load->view('genReporte/reportes/reporte_filtro_abc');
        $this->load->view('template/close_content_container');
        $this->load->view('template/footer');
    }

    public function rabcr() {
        global $admin, $data;
        $e_empresa_id = $this->input->post('empresa');
        $d_division_id = $this->input->post('division');
        $m_modulo_id = $this->input->post('modulo');
        $sm_sub_modulo_id = $this->input->post('submodulo');
        $data['prom'] = $this->cc_model_a->promedioXEDMSM($e_empresa_id, $d_division_id, $m_modulo_id, $sm_sub_modulo_id);
        $this->load->view('template/header', $admin);
        $this->load->view('template/open_content_container');
        $this->load->view('menu/menu_admin', $data);
        $this->load->view('genReporte/reportes/resultado_filtro_abc');
        $this->load->view('template/close_content_container');
        $this->load->view('template/footer');
    }

}
